package com.wisezone.HomeWork.home0218;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class Test {
    public static void main(String[] args) {
        try {
            //取得Person类对应的Class对象
            Class<?> c1 = Class.forName("com.wisezone.demo0218.Person");
//            Type[] types = c1.getGenericInterfaces();//接口
            Type t = c1.getGenericSuperclass();//继承的父类
            ParameterizedType type = (ParameterizedType)t;
            Type[]ty = type.getActualTypeArguments();
            
            System.out.println(((Class)ty[0]).getName());
//            for (Type t: types){
//                System.out.println(t);
//            }

            Method method = c1.getMethod("show");
            
            Annotation[] ans = method.getAnnotations();
            for (Annotation a:ans){
                System.out.println(a);
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
    }
}
